package www.xpu.edu.app;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.List;

public class WorkAdapter extends ArrayAdapter<Work> {
    private int resourceId;
    public WorkAdapter( Context context, int resource,  List<Work> objects) {
        super(context, resource, objects);
        resourceId=resource;
    }

    @Override
    public View getView(int position,  View convertView,ViewGroup parent) {
       Work work=getItem(position);
       View view=LayoutInflater.from(getContext()).inflate(resourceId,parent,false);
       TextView text1=(TextView)view.findViewById(R.id.work_text1);
       TextView text2=(TextView)view.findViewById(R.id.work_text2);
       TextView text3=(TextView)view.findViewById(R.id.work_text3);
       TextView text4=(TextView)view.findViewById(R.id.work_text4);
       text1.setText(work.getJob());
       text2.setText(work.getSwap());
       text3.setText(work.getAdd());
       text4.setText(work.getTime());
       return view;
       // return super.getView(position, convertView, parent);
    }
}
